package utility;

import java.io.Serializable;

import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.springframework.orm.hibernate3.SessionFactoryUtils;

public class Utility implements Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	public static Session getSession(SessionFactory sessionFactory) {
		Session session = null;
		try {
			session = sessionFactory.getCurrentSession();
			if (null == session) {
				session = SessionFactoryUtils.getNewSession(sessionFactory);
			}
		} catch (Exception ex) {
			ex.printStackTrace();
		}
		return session;
	}
}
